package cn.wolfcode.shop;

import cn.wolfcode.shop.seckillserver.resolver.UserArgumentResolver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@SpringBootApplication
@EnableCircuitBreaker
@EnableFeignClients
public class SeckillServerApplication implements WebMvcConfigurer {

	public static void main(String[] args) {
		SpringApplication.run(SeckillServerApplication.class, args);
	}

	@Bean
	public UserArgumentResolver userArgumentResolver(){
		return new UserArgumentResolver();
	}

	@Override
	public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
		resolvers.add(userArgumentResolver());
	}

}
